package com.happycat.utils;

import com.happycat.ResponseHeaderModel;
import com.happycat.ResponseModel;
import com.happycat.SysContants;

public class ResponseModelUtils<T> {
   
	public static ResponseHeaderModel success() {
		ResponseHeaderModel responseHeaderModel = new ResponseHeaderModel();
		responseHeaderModel.setCode(SysContants.SYS_SUCCESS_CODE);
		responseHeaderModel.setMessage("成功！");
		return responseHeaderModel;
	}
	
	public static ResponseHeaderModel success(String message) {
		ResponseHeaderModel responseHeaderModel = new ResponseHeaderModel();
		responseHeaderModel.setCode(SysContants.SYS_SUCCESS_CODE);
		responseHeaderModel.setMessage(message);
		return responseHeaderModel;
	}
	public static <T> ResponseModel<T> success(String message,T t) {
		ResponseModel<T> responseModel = new ResponseModel<T>();
		responseModel.setCode(SysContants.SYS_SUCCESS_CODE);
		responseModel.setMessage(message);
		responseModel.setData(t);
		return responseModel;
	}
	
	
	public static <T> ResponseModel<T> fail(String message,T t) {
		ResponseModel<T> responseModel = new ResponseModel<T>();
		responseModel.setCode(SysContants.SYS_FAIL_CODE);
		responseModel.setMessage(message);
		return responseModel;
	}
	
	public static ResponseHeaderModel fail(String message) {
		ResponseHeaderModel responseHeaderModel = new ResponseHeaderModel();
		responseHeaderModel.setCode(SysContants.SYS_FAIL_CODE);
		responseHeaderModel.setMessage(message);
		return responseHeaderModel;
	}
	public static ResponseHeaderModel fail(int code ,String message) {
		ResponseHeaderModel responseHeaderModel = new ResponseHeaderModel();
		responseHeaderModel.setCode(code);
		responseHeaderModel.setMessage(message);
		return responseHeaderModel;
	}
}
